<meta charset="UTF-8">
<div class="mcy_body">
	<div id="home">
		<ul class="breadcrumb">
			<li><span class="glyphicon glyphicon-home"></span>&emsp;当前位置：</li>
			<li class="active">博客</li>
		</ul>
		<ul class="flow-default" id="LAY_demo1"></ul>
	</div>
</div>

<script type="text/javascript">
layui.use('flow', function(){
	  var flow = layui.flow;
	 
	  flow.load({
	    elem: '#LAY_demo1' //流加载容器
	    ,scrollElem: '#LAY_demo1' //滚动条所在元素，一般不用填，此处只是演示需要。
	    ,done: function(page, next){ //执行下一页的回调
	      
	      //模拟数据插入
	      setTimeout(function(){
	        var lis = [];
	        $.post('blog/fysj2',{page:page},function(res){
	        		 layui.each(res.data, function(index, item){
	 	                lis.push("<div class='list-group'><a href='#' class='list-group-item' onclick='details("+item.id+")'>"+
	 	                		"<h4 class='list-group-item-heading'>"+item.title+"</h4><p class='list-group-item-text'>"
	 	                		+item.user.nickname+"   |   "+item.updateDate+
	 	                		"</p></a>"+
	 	                		"</div>");
	 	              }); 	   	       
	        next(lis.join(''), page < res.pages); //假设总页数为 10
	        $('[data-toggle="tooltip"]').tooltip()
	        });  
	        //执行下一页渲染，第二参数为：满足“加载更多”的条件，即后面仍有分页
	        //pages为Ajax返回的总页数，只有当前页小于总页数的情况下，才会继续出现加载更多
	      });
	    }
	  });
	  
	});
	
	function details(id){
		window.open("blog/visit?id="+id);
	}
</script>

